package de.gameduell.framework.threads 
{
	
	/**
	 * marker for sync (action queue blocking) and async (non blocking) leightweight long life callbacks 
	 * alternative names: Task, Proccess, Timer, WorkerThread
	 * 
	 * documentation:
	 * http://de.wikipedia.org/wiki/Mutex
	 * http://de.wikipedia.org/wiki/Thread_%28Informatik%29#Threaddarstellung_in_UML
	 * http://de.wikipedia.org/wiki/Mutex#Aktives_und_passives_Warten
	 * 
	 * @author Ferry Trunschke
	 */
	public interface IThread {
		
		/**
		 * @return true when this thread should be synchronized, false if the thread should be executed async.
		 */
		function get isBlockingThread():Boolean;
		
		// allow to dump all thread with clear name, when wrapping include embedded target (e.g. GDActions)!
		function get description():String;
		
		/**
		 * execute piece of code and return if thread is running (and blocking when isBlockingThread returns true)
		 * normally a thread is bound onto a boolean mutex (like tween.isPlaying)
		 * example: return tween.isPlaying
		 * 
		 * documentation: http://de.wikipedia.org/wiki/Mutex#Aktives_und_passives_Warten
		 * 
		 * @return true when thread is running, false is thread is finished
		 */
		function run():Boolean;
		
		// example: show popup
		function onStartExecution():void;
		
		// example: hide popup
		function onFinishExecution():void;
		
		
		
	}
	
}